﻿using System;
namespace padmsg._api
{
    using yunio;
    internal partial class padapi
    {
        /// <summary>
        /// 获取登录二维码
        /// </summary>
        public static YunioJson download_login_QRcode(string uri, string token)
        {
            uri += "/login/GetLoginQrCodeNew";

            var json = new YunioJson("{'Check':false, 'Proxy':''}");
            return YunioHttp.PostJson(uri, YunioParam.New("key", token), json);
        }
        /// <summary>
        /// 唤醒登录
        /// </summary>
        public static YunioJson wakeup_login(string uri, string token)
        {
            uri += "/login/WakeUpLogin";

            var json = new YunioJson("{'Check':false, 'Proxy':''}");
            return YunioHttp.PostJson(uri, YunioParam.New("key", token), json);
        }
        /// <summary>
        /// 获取登录状态
        /// </summary>
        public static YunioJson get_loginstatus(string uri, string token)
        {
            uri += "/login/GetLoginStatus";

            return YunioHttp.GetJson(uri, YunioParam.New("key", token));
        }
        /// <summary>
        /// 退出登录
        /// </summary>
        public static YunioJson logout(string uri, string token)
        {
            uri += "/login/LogOut";

            return YunioHttp.GetJson(uri, YunioParam.New("key", token));
        }
        public static YunioJson new_token(string uri, string adminkey, int day = 365)
        {
            uri += "/admin/GenAuthKey1";

            var json = YunioJson.NewObj().SetNumber("Count", 1).SetNumber("Days", day);
            return YunioHttp.PostJson(uri, YunioParam.New("key", adminkey), json);
        }
        public static YunioJson get_alldevice(string uri, string adminkey)
        {
            uri += "/admin/GetAllDevices";

            return YunioHttp.GetJson(uri, YunioParam.New("key", adminkey));
        }
    }
}
